package com.hzwq.demo.Login.controller;

import com.hzwq.demo.Login.bo.SdteUser;
import com.hzwq.demo.Login.service.ISdteUserService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class UserController {

    private static Logger log = Logger.getLogger(UserController.class);

    @Autowired
    private ISdteUserService SdteUserService;

    @RequestMapping("/getUserList")
    @ResponseBody
    public List<SdteUser> getUserList(){
        SdteUser user = new SdteUser();
        user.setUserName("H");
        return SdteUserService.getUserList(user);
    }

    @RequestMapping("/addUser")
    @ResponseBody
    public SdteUser addUser(){
        SdteUser user = new SdteUser();
        user.setUserName("qazwsx");
        SdteUserService.addUser(user);
        return user;
    }

    @RequestMapping("/deleteUser")
    @ResponseBody
    public String deleteUser(){
        long userId = 24l;
        SdteUserService.deleteUser(userId);
        return "deleteUser";
    }
}
